Improve DocLineComparator performance #2575#2576
Closed
mehmet-karaman wants to merge 1 commit intoeclipse-platform:masterfrom
Closed
Improve DocLineComparator performance #2575#2576mehmet-karaman wants to merge 1 commit intoeclipse-platform:masterfrom
mehmet-karaman wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
Contributor
Author
|
Changed PR to draft, need to fix the test failures org.eclipse.compare.tests |
Contributor
| return linesToCompare[0].equals(linesToCompare[1]); | ||
| String s1 = linesToCompare[0]; | ||
| String s2 = linesToCompare[1]; | ||
| if (s1.isEmpty() == s2.isEmpty()) { |
Member
There was a problem hiding this comment.
So two non empty lines are equal?
Contributor
Author
There was a problem hiding this comment.
How it comes? The first and the second check is just to avoid index out of bounds exceptions..
Member
There was a problem hiding this comment.
Put a breakpoint in the return true new line and run DocLineComparatorTest
Contributor
Author
There was a problem hiding this comment.
It is supposed to work only on the positive case :) Going to check this.
Add a lightweight preliminary check before invoking String.equals(), which avoids unnecessary overhead while preserving correctness for other comparison cases. Fixes eclipse-platform#2575
85a4a63 to
6bc4e2a
Compare
Contributor
Author
|
Closing this PR, it seems that this is only a micro optimization in the whole compare algorithm. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a lightweight preliminary check before invoking String.equals(), which avoids unnecessary overhead while preserving correctness for other comparison cases.
Fixes #2575